<!DOCTYPE html>
<html lang="zh">
<head>
<base href="/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>首页 - 光年(Light Year Admin)后台管理系统模板</title>
  <link rel="icon" href="favicon.ico" type="image/ico">
  <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
  <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
  <meta name="author" content="yinqi">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/materialdesignicons.min.css" rel="stylesheet">

  <link href="css/style.min.css" rel="stylesheet">

  <link href="css/animate.css" rel="stylesheet">


  <link rel="stylesheet" href="js/jconfirm/jquery-confirm.min.css">
  <!--时间选择插件-->
  <link rel="stylesheet" href="js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
  <!--日期选择插件-->
  <link rel="stylesheet" href="js/bootstrap-datepicker/bootstrap-datepicker3.min.css">


  <link href="js/bootstrap-validator/css/bootstrapValidator.css" rel="stylesheet">
</head>
  
<body data-theme="default">
<body class="lyear-layout-web">
  <div class="lyear-layout-container">
    <aside class="lyear-layout-sidebar">

      <!-- logo -->
      <div id="logo" class="sidebar-header">
        <a href="admin/index.jsp"><img src="images/upt.png" title="LightYear" alt="LightYear" /></a>
      </div>
      <div class="lyear-layout-sidebar-scroll">

        <nav class="sidebar-main">
          <ul class="nav nav-drawer">
            <li class="nav-item active"> <a href="admin/index.html"><i class="mdi mdi-home"></i> 后台首页</a> </li>
            <li class="nav-item nav-item-has-subnav">
              <a href="javascript:void(0)"><i class="mdi mdi-palette"></i>游戏管理</a>
              <ul class="nav nav-subnav">
                <li> <a href="admin/GamingPlatform.html">游戏平台管理</a> </li>
                <li> <a href="admin/Games.html">游戏管理</a> </li>
                <li> <a href="admin/Characters.html">游戏人物管理</a> </li>


              </ul>
            </li>

          </ul>
        </nav>


      </div>

    </aside>
    <!--End 左侧导航-->

    <!--头部信息-->
    <header class="lyear-layout-header">

      <nav class="navbar navbar-default">
        <div class="topbar">

          <div class="topbar-left">
            <div class="lyear-aside-toggler">
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
            </div>
            <span class="navbar-page-title"> </span>
          </div>

          <ul class="topbar-right">
            <li class="dropdown dropdown-profile">
              <a href="javascript:void(0)" data-toggle="dropdown">

                <span><span id="user"></span> <span class="caret"></span></span>
              </a>
              <ul class="dropdown-menu dropdown-menu-right">

                <li> <a href="javascript:void(0)" id="Update"><i class="mdi mdi-lock-outline"></i> 修改密码</a> </li>

                <li class="divider"></li>
                <li> <a href="javascript:void(0)" id="out"><i class="mdi mdi-logout-variant"></i> 退出登录</a> </li>
              </ul>
            </li>
            <!--切换主题配色-->

            <!--切换主题配色-->
          </ul>

        </div>
      </nav>

    </header>
    <!--左侧导航-->

    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">


        <div class="row">
          <div class="col-lg-12">
            <div class="card">

                <div class="card-body">

                  <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
                  <div id="main" style="width: 1200px;height:400px;"></div>
                  <div id="main2" style="width: 1200px;height:400px;"></div>


                  </div>

                </div>
              </div>
            </div>
          </div>



      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>
  <div class="modal fade" id="dateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" >修改密码</h4>
        </div>
        <div class="modal-body">
          <form id="dateFrom" class="form-horizontal" action="lyear_forms_elements.html" method="post" onsubmit="return false;">

            <div class="form-group">
              <label class="col-md-4 control-label" for="upasswordUpdate">当前密码</label>
              <div class="col-md-7">
                <input class="form-control" type="text" id="upasswordUpdate" name="upasswordUpdate" placeholder="请输入当前密码">
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-4 control-label" for="dpasswoUpdate">请输入修改后的密码</label>
              <div class="col-md-7">
                <input class="form-control" type="text" id="dpasswoUpdate" name="dpasswoUpdate" placeholder="请输入修改后的密码">
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-4 control-label" for="dpasswoagain">再次输入修改的密码</label>
              <div class="col-md-7">
                <input class="form-control" type="text" id="dpasswoagain" name="dpasswoagain" placeholder="请再次输入修改的密码">
              </div>
            </div>
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
          <button type="button" class="btn btn-primary" onclick="updatePassword()">确定</button>
        </div>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script type="text/javascript" src="js/bootstrap.min.js"></script>
  <script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>

  <!--图表插件-->
  <script type="text/javascript" src="js/Chart.js"></script>
  <script  src="js/template-web.js"></script>
  <!--对话框-->
  <script src="js/jconfirm/jquery-confirm.min.js"></script>
  <script src="js/bootstrap-notify.min.js"></script>

  <script type="text/javascript" src="js/lightyear.js"></script>

  <!--时间选择插件-->
  <script src="js/bootstrap-datetimepicker/moment.min.js"></script>
  <script src="js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
  <script src="js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
  <!--日期选择插件-->
  <script src="js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
  <script src="js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
  <script type="text/javascript" src="js/main.min.js"></script>
  <script type="text/javascript" src="js/bootstrap-validator/js/bootstrapValidator.js"></script>
  <script src="js/echarts.js"></script>

<!--图表插件-->
<script type="text/javascript" src="js/Chart.js"></script>

  <script type="text/javascript">
    $("#dateFrom").bootstrapValidator({
      feedbackIcons: {//这里是用来对应三种不同状态时，在输入框后面添加的图标
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
      },
      fields:{//哪些字段需要验证，和html中的输入框，下拉框等等表单name属性所对应。
        upasswordUpdate:{
          validators:{//从这里也可以容易的看出可以有多个验证信息
            notEmpty:{//非空验证
              message:"请输入密码！！！" //提示信息，当你不写这里时它会自动的调用自带的提示信息，默认是英文，可导入language下的中文JS文件
            }

          }
        },
        dpasswoUpdate:{
          validators:{
            notEmpty:{
              message:"请输入修改后的密码！！！"
            }
          }
        },
        dpasswoagain:{
          validators:{
            notEmpty:{
              message:"请输入修改后的密码！！！"
            },
            identical: {//用来判断制定的字段和当前字段一致与否
              field: 'dpasswoUpdate',
              message: "两次输入的密码不一致！！！"
            }
          }
        }

      }
    });
    $("#Update").click(function showUpdate(){
      $("#dateModal").modal("show")
      //查询部门信息
      // $.ajax({
      //     url:"admin/DepartmentController?action=findById",
      //     type:'POST',
      //     data: {did:did},
      //     dataType:'JSON',
      //     success:function (resp){
      //         didupdate = resp.data.did
      //         if(resp.code==10000) {
      //             $("#dnameUpdate").val(resp.data.dname)
      //             $("#dlocationUpdate").val(resp.data.dlocation)
      //             $("#updateModal").modal("show")
      //         }else{
      //             lightyear.notify(resp.msg, 'danger', 1000, 'mdi mdi-emoticon-sad', 'top', 'center');
      //         }
      //     }
      // })

    })
    function updatePassword(){
      $("#dateFrom").data('bootstrapValidator').validate();//相当于触发一次所有的验证
      if($("#dateFrom").data('bootstrapValidator').isValid()){
        $.ajax({
          url:"adminup",
          dataType:'JSON',
          type:'POST',
          data:{password:$("#upasswordUpdate").val(),password1:$("#dpasswoUpdate").val()},
          success:function (resp){
            if(resp.code==10000){
              $("#dateModal").modal("hide")
              //清空数据
              //$("#UpdateFrom")[0].reset();
              lightyear.notify(resp.msg, 'success', 1000, 'mdi mdi-emoticon-happy', 'top', 'center' );
              //findAll();
              setTimeout(function() {
                // 在这里放置你想要延迟执行的代码
                window.location.href="/login.html";
              }, 1000)

            }else{
              lightyear.notify(resp.msg, 'danger', 1000, 'mdi mdi-emoticon-sad', 'top', 'center');
            }
          }
        })}
    }


    $("#out").click(function (){
      $.ajax({
        url:"loginout",
        type:"GET",
        dataType:"JSON",
        success:function (resp){
          window.location.href="/login.html";
        }
      })
    })



    $.ajax(
            {
              url:"admin/info",
              type:"GET",
              dataType:"JSON",
              success:function (resp){
                console.log(resp.data)
                $("#user").text(resp.data.username)
              }
            }
    )
    $.ajax({
      url:"admin/GamingPlatformController/findPlaAndGames",
      type:'GET',
      dataType:'JSON',
      success:function (resp){
        console.log(resp.data)
        var xArr = new Array();
        var yArr = new Array();
        for (let i = 0; i < resp.data.length; i++) {
          var datum = resp.data[i];
          xArr.push(datum.planame)
          yArr.push(datum.ct)
        }
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
        var option = {
          title: {
            text: '游戏平台名字以及内部游戏个数'
          },
          tooltip: {},
          legend: {
            data: ['游戏个数']
          },
          xAxis: {
            data:xArr
          },
          yAxis: {},
          series: [
            {
              name: '游戏个数',
              type: 'bar',
              data: yArr
            }
          ]
        };
        myChart.setOption(option);
      }
    })
            $.ajax({
              url:"admin/GamesController/findrevenue",
              type:'GET',
              dataType:'JSON',
              success:function (resp){
                console.log(resp.data)
                var xArr = new Array();
                var yArr = new Array();
                for (let i = 0; i < resp.data.length; i++) {
                  var datum = resp.data[i];
                  xArr.push(datum.gname)
                  yArr.push(datum.revenue)
                }
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('main2'));

                // 指定图表的配置项和数据
                var option = {
                  title: {
                    text: '游戏营收前五'
                  },
                  tooltip: {},
                  legend: {
                    data: ['营收']
                  },
                  xAxis: {
                    data:xArr
                  },
                  yAxis: {},
                  series: [
                    {
                      name: '营收',
                      type: 'bar',
                      data: yArr
                    }
                  ]
                };
                myChart.setOption(option);
              }
            })


    // 使用刚指定的配置项和数据显示图表。



    // 使用刚指定的配置项和数据显示图表。

  </script>
</body>
</body>
</html>